<#include "/common/head.ftl">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/trict.dtd">

<html>

<head>
	<title>${Global.getValue('title')}</title>
	<meta http-equiv="content-type" content="text/html; charset=utf8">
	
	<link rel="Shortcut Icon" href="../images/ncms.ico" type="image/x-icon"/>

	<link rel="stylesheet" type="text/css" href="../styles/home.css"/>
  
	<script language="javascript" type="text/javascript" src="../scripts/prototype.js"></script>
	<script language="javascript" type="text/javascript" src="../scripts/home.js"></script>
	<script language="javascript" type="text/javascript" src="../scripts/sha1.js"></script>
</head>

<body>

<div id="container">
<div id="top_part">	
	<div class="header">
		
	</div>
	<div class="body_content">
		<div id="menu_bar">
			<div style="float:left;padding-top:5px"></div>
			<div class="last_menu"></div>
			<div class="logout_box">
			</div>			
		</div>
		<div id="main">
<br/><br/><br/><br/>

<noscript>
	<div style="text-align:center;color:red;font-weight:bold">${i18n.getMessage('noscript')}</div>
</noscript>

<form action="login.sgt" method="POST" onsubmit="login(this); return false" onreset="$('loginError').innerHTML='';">
		<table id="dataTable" align="center" cellspacing="5">
			<tr>
				<td></td>
				<td>
					<span id="loginError" style="color:red">${error!}</span>
				</td>
			</tr>
			<tr>
				<td class="name">${i18n.getMessage('username')}:</td>
				<td><input type="text" name="username" style="width:200px"/> </td>
			</tr>
			<tr>
				<td class="name">${i18n.getMessage('password')}:</td>
				<td><input type="password" name="password" style="width:200px"/> </td>
			</tr>
			<tr>
				<td class="name">${i18n.getMessage('site')}:</td>
				<td>
					<select name="siteId" style="width:204px">
						<#list sites as site>
							<option value="${(site.id)!}" <#if (site.name == 'Management')>selected</#if>>${(site.name)!}</option>
						</#list>
					</select>
				</td>
			</tr>
			<tr>
				<td></td>
				<td>
					<input type="submit" value="${i18n.getMessage('login')}" class="button_style"/> 
					<input type="reset" value="${i18n.getMessage('reset')}" class="button_style"/> 
				</td>
			</tr>
		</table>
</form>

<br/><br/><br/><br/><br/><br/><br/><br/>

</td>
</tr>
</table>
</div>			
</div>
</div>
<div id="bottom_part">
	<div class="footer">${i18n.getMessage('copyright')}</div>	
</div>
</div>
</body>
</html>

<script>
	function login(form) {
		var url = form.action;
		url += '?' + Form.Element.serialize(form.username);
		url += '&password=' + hex_sha1(form.password.value); 
		url += '&siteId=' + form.siteId.value;
   		location.href = url;
	}
	
	document.forms[0].username.focus();
</script>